import Main from '../view/main/Main'

/**
 * 登录
 * @type {{path: string, name: string, meta: {title: string}, component: loginRouter.component}}
 */
export const loginRouter = {
  path: '/login',
  name: 'login',
  meta: {
    title: 'Login - 登录',
    notNeedToken:true
  },
  component: resolve => { require(['@/view/acc/login/login.vue'], resolve) }
};


export const page404 = {
  path: '/*',
  name: 'error_404',
  meta: {
    title: '404-页面不存在',
    notNeedToken:true
  },
  component: resolve => { require(['@/view/error_page/404.vue'], resolve) }
}

// 作为Main组件的子页面展示但是不在左侧菜单显示的路由写在otherRouter里
export const otherRouter = {
  path: '/',
  name: 'otherRouter',
  component: Main,
  children: [
    /*{
      path: '/wechat/room/:loginId/:nick',
      meta:{title: '微信群列表'},
      name: 'wechatRoomList',
      component: resolve => { require(['@/view/main/wechat/wechatRoomList.vue'], resolve) }
    }*/
  ]
}

export const  menuRouter = [
  {
    path: '/',
    icon: 'ios-home',
    meta:{title: '首页'},
    name: 'home',
    component: Main,
    children: [
      { path: 'home', meta:{title: '首页'}, name: 'home_index', component: resolve => { require(['@/view/main/index/home.vue'], resolve); } },
    ]
  },
 {
    path: '/test',
    icon: 'ios-chatbubbles',
    meta:{title: '我的菜单'},
    name: 'test-menu',
    component: Main,
    children: [
      { path: 'menu',meta:{title: '我的菜单'}, name: 'test-menu-list', component: resolve => { require(['@/view/main/test/MyMenu.vue'], resolve); } }
    ]
  }
]

export const routers = [
  otherRouter,
  loginRouter,
  ...menuRouter,
  page404
];

